<?php
	require_once("config/config.inc");
	$connParam = $_DBCONFIG['readwrite'];
	$rwConn = new mysqli($connParam['host'],$connParam['user'],$connParam['pass'],$connParam['db']);

	function checkDbError(){
		global $rwConn;
		if($rwConn->errno){
			$retVal = array(
				'success' => false,
				'message' => "Database Error. {$rwConn->error}",
			);
			returnAPI($retVal);
		}
	}
	function returnAPI($retVal=null){
		echo json_encode($retVal);
		exit();
	}
	function getParam($key=null){
		if(is_null($key)) return null;
		return isset($_REQUEST[$key])?$_REQUEST[$key]:null;
	}
?>
